HAL DMA2D types migration

This section provides information about the HAL DMA2D types migration.

HAL DMA2D callback ID type definition

HAL1

HAL2

typedef enum
 {
   HAL_DMA2D_CLUTLOADINGCPLT_CB_ID
   HAL_DMA2D_LINEEVENT_CB_ID
   HAL_DMA2D_MSPDEINIT_CB_ID
   HAL_DMA2D_MSPINIT_CB_ID
   HAL_DMA2D_TRANSFERCOMPLETE_CB_ID
   HAL_DMA2D_TRANSFERERROR_CB_ID
 } HAL_DMA2D_CallbackIDTypeDef
  • Removed; the callback registration is managed by dedicated functions for each DMA2D event. For more details, see : HAL DMA2D registers callback functions

  • HAL_DMA2D_MSPINIT_CB_ID and HAL_DMA2D_MSPDEINIT_CB_ID are removed because the functions HAL_DMA2D_MspInit() and HAL_DMA2D_MspDeInit() are removed.

Related concepts:


HAL DMA2D state type definition

HAL1

HAL2

typedef enum
{
  HAL_DMA2D_STATE_RESET
  HAL_DMA2D_STATE_READY
  HAL_DMA2D_STATE_BUSY

  HAL_DMA2D_STATE_SUSPEND

  HAL_DMA2D_STATE_TIMEOUT
  HAL_DMA2D_STATE_ERROR
} HAL_DMA2D_StateTypeDef;
typedef enum
{
  HAL_DMA2D_STATE_RESET
  HAL_DMA2D_STATE_IDLE
  HAL_DMA2D_STATE_XFER_ACTIVE
  HAL_DMA2D_STATE_CLUT_LOADING_ACTIVE
  HAL_DMA2D_STATE_XFER_SUSPEND
  HAL_DMA2D_STATE_CLUT_LOADING_SUSPEND
} hal_dma2d_state_t;

Related concepts: Revised and optimized HAL state machine


HAL DMA2D handle type definition

HAL1

HAL2

DMA2D_HandleTypeDef
hal_dma2d_handle_t

Related concepts:


HAL DMA2D callback type definition

HAL1

HAL2

pDMA2D_CallbackTypeDef
hal_dma2d_cb_t

HAL DMA2D initialization type definition

In HAL2:
  • The DMA2D Mode parameter is removed. New configuration APIs are introduced each tailored for a specific transfer mode.

  • The output ColorMode and RedBlueSwap parameters are merged and the user can directly select the chosen output color format with the red and blue swap integrated.

  • The OutputOffset and LineOffsetMode parameters are merged.

  • The AlphaInverted parameter is removed. For enabling or disabling the output alpha inversion use instead: HAL_DMA2D_EnableOutputAlphaInversion(hal_dma2d_handle_t *hdma2d, hal_dma2d_input_t input), HAL_DMA2D_DisableOutputAlphaInversion(hal_dma2d_handle_t *hdma2d, hal_dma2d_input_t input).

HAL1

HAL2

typedef struct
{
  uint32_t             Mode;
  uint32_t             ColorMode;
  uint32_t             OutputOffset;
  uint32_t             AlphaInverted;
  uint32_t             RedBlueSwap;
  uint32_t             BytesSwap;
  uint32_t             LineOffsetMode;
} DMA2D_InitTypeDef;
Removed; instead, DMA2D configuration is performed using one
of the following six mode-specific configuration structures,
depending on the required operation:
- memory to memory transfer mode.
- memory to memory with pixel format conversion transfer mode.
- memory to memory with blending transfer mode.
- register to memory transfer mode.
- memory to memory with blending transfer mode and fixed color foreground.
- memory to memory with blending transfer mode and fixed color background.

Note

See the DMA2D configuration functions for detailed instruction.

Related concept: Removal and conversion of init structure to configuration structure

Related use case: Use case: DMA2D transfer polling mode


HAL DMA2D layer configuration type definition

In HAL2:
  • The ChromaSubSampling and the InputColorMode parameters are merged and the user can directly select the input YCbCr color format with the chroma subsampling integrated.

  • The RedBlueSwap and the InputColorMode parameters are merged and the user can directly select the input color format with the red and blue swap integrated.

  • The AlphaInverted parameter is removed. For enabling or disabling alpha inversion use instead: HAL_DMA2D_EnableInputAlphaInversion(hal_dma2d_handle_t *hdma2d, hal_dma2d_input_t input), HAL_DMA2D_DisableInputAlphaInversion(hal_dma2d_handle_t *hdma2d, hal_dma2d_input_t input).

HAL1

HAL2

typedef struct
{
  uint32_t             InputOffset;
  uint32_t             InputColorMode;
  uint32_t             AlphaMode;
  uint32_t             InputAlpha;
  uint32_t             AlphaInverted;
  uint32_t             RedBlueSwap;
 #if defined(DMA2D_FGPFCCR_CSS)
  uint32_t             ChromaSubSampling;
 #endif /* DMA2D_FGPFCCR_CSS  */
} DMA2D_LayerCfgTypeDef;
Removed; instead, DMA2D layer configuration is performed using one
of the following six mode-specific configuration structures, depending on the required operation:
- memory to memory transfer mode.
- memory to memory with pixel format conversion transfer mode.
- memory to memory with blending transfer mode.
- register to memory transfer mode.
- memory to memory with blending transfer mode and fixed color foreground.
- memory to memory with blending transfer mode and fixed color background.

Note

See the DMA2D configuration functions for detailed instruction.

Related concept: Removal and conversion of init structure to configuration structure

Related use case: Use case: DMA2D transfer polling mode


HAL DMA2D CLUT configuration type definition

HAL1

HAL2

typedef struct
{
  uint32_t *pCLUT;
  uint32_t CLUTColorMode;
  uint32_t Size;
} DMA2D_CLUTCfgTypeDef;
typedef struct
{
  uint32_t                    *p_clut;
  hal_dma2d_clut_color_mode_t color_mode;
  uint8_t                     size;
} hal_dma2d_clut_config_t;

Related concept: Replaced TypeDef suffix with _t in type names